#!/bin/bash
[ ! -e RUNNING ]   || rm RUNNING
[ ! -e COMPLETED ] || rm COMPLETED
[ ! -e ERROR ]     || rm ERROR
[ -d target ]      || mkdir target
if [ -e Templets/Taskbag/mpi.h ]
then
	mpicxx -Wall -o target/Taskbag-`uname -m` Templets/Taskbag/taskbag.cpp Templets/Taskbag/tbag.cpp -lpthread > RUNNING 2>&1 && mv RUNNING COMPLETED || mv RUNNING ERROR
else
	g++ -Wall -o target/Taskbag-`uname -m` Templets/Taskbag/taskbag.cpp Templets/Taskbag/tbag.cpp -lpthread > RUNNING 2>&1 && mv RUNNING COMPLETED || mv RUNNING ERROR
fi